Azure Functions

ACG LINK

Azure Functions Overview:

Azure Functions is a serverless compute service that enables you to run event-triggered code without explicitly provisioning or managing infrastructure. It's suitable for various application scenarios.

Key Features:

Azure Functions Configuration Examples:

1. Creating an HTTP-triggered Function in the Azure Portal:

  1. Go to the Azure Portal.
  2. Click on "Create a resource" > "Compute" > "Function App."
  3. Configure the Function App settings and create a new function with an HTTP trigger.
  4. Write the code for the function and test it using the provided URL.

2. Creating a Timer-triggered Function using Azure CLI:

        
az functionapp create --resource-group MyResourceGroup --name MyFunctionApp --consumption-plan-location eastus --runtime dotnet
az function create --name MyTimerFunction --resource-group MyResourceGroup --functionapp MyFunctionApp --template "TimerTrigger" --cron "0 */5 * * * *"
        
    

3. Integrating Azure Functions with Azure Storage Queue:

        
public static class QueueTriggerFunction
{
    [FunctionName("QueueTriggerFunction")]
    public static void Run(
        [QueueTrigger("myqueue-items", Connection = "AzureWebJobsStorage")] string myQueueItem,
        ILogger log)
    {
        log.LogInformation($"C# Queue trigger function processed message: {myQueueItem}");
    }
}
        
    

4. Using Azure Functions Extensions:

        
public static void Run(
    [BlobTrigger("mycontainer/{name}", Connection = "AzureWebJobsStorage")] Stream myBlob,
    string name,
    ILogger log)
{
    log.LogInformation($"C# Blob trigger function processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
}